home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 414_02 / portable / werase.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-17  |  1.5 KB  |  71 lines

  1. #define    CURSES_LIBRARY    1
  2. #include <curses.h>
  3. #undef    werase
  4.  
  5. #ifdef PDCDEBUG
  6. char *rcsid_werase = "$Header: C:\CURSES\portable\RCS\werase.c 2.1 1993/06/18 20:19:29 MH Rel MH $";
  7. #endif
  8.  
  9.  
  10.  
  11.  
  12. /*man-start*********************************************************************
  13.  
  14.   werase()    - copy blanks into window
  15.  
  16.   X/Open Description:
  17.      These functions copy blanks to every position in the window.
  18.  
  19.      NOTE: erase() is a macro.
  20.  
  21.   PDCurses Description:
  22.      There is no additional PDCurses functionality.
  23.  
  24.   X/Open Return Value:
  25.      These functions return OK on success and ERR on error.
  26.  
  27.   PDCurses Errors:
  28.      It is an error to call this function with a NULL window pointer.
  29.  
  30.   Portability:
  31.      PDCurses    int werase( WINDOW* win );
  32.      X/Open Dec '88    int werase( WINDOW* win );
  33.      BSD Curses    int werase( WINDOW* win );
  34.      SYS V Curses    int werase( WINDOW* win );
  35.  
  36. **man-end**********************************************************************/
  37.  
  38. int    werase(WINDOW *win)
  39. {
  40.     chtype*    end;
  41.     chtype*    start;
  42.     int    y;
  43.     chtype    blank;
  44.  
  45. #ifdef PDCDEBUG
  46.     if (trace_on) PDC_debug("werase() - called\n");
  47. #endif
  48.  
  49.     if (win == (WINDOW *)NULL)
  50.         return( ERR );
  51.  
  52.     blank = win->_blank | win->_attrs;
  53.  
  54.     for (y = win->_tmarg; y <= win->_bmarg; y++)
  55.     {
  56.         start = win->_y[y];
  57.         end = &start[win->_maxx - 1];
  58. /* changed JGB 6/92 < to <= */
  59.         while (start <= end)
  60.         {
  61.             *start++ = blank;
  62.         }
  63.         win->_firstch[y] = 0;
  64.         win->_lastch[y] = win->_maxx - 1;
  65.     }
  66.     win->_cury = win->_tmarg;
  67.     win->_curx = 0;
  68.     return( OK );
  69. }
  70.  
  71.